#ifndef _BSP_QPI_OPT_H_
#define _BSP_QPI_OPT_H_

#include "bsp.h"

void bsp_qpi_init(void);

/*****************************************************************************
* @brief  cmd. opt mode
*****************************************************************************/
void bsp_qpi_opt_mode(qspi_operate_mode_type opt_mode);

/*****************************************************************************
* @brief  signal cmd.
*****************************************************************************/
void bsp_qpi_cmd_exe(uint8_t cmd);

/*****************************************************************************
* @brief   cmd set / get.
*****************************************************************************/
void bsp_qpi_cmd_set(uint8_t cmd, uint8_t par);
uint8_t bsp_qpi_cmd_get(uint8_t cmd);

/*****************************************************************************
* @brief   cmd set / get. 包含1字节地址
*****************************************************************************/
void bsp_qpi_cmd_aset(uint8_t cmd, uint8_t addr, uint8_t par);
uint8_t bsp_qpi_cmd_aget(uint8_t cmd, uint8_t addr);

/*****************************************************************************
* @brief   cmd auto. len 应小于128
*****************************************************************************/
void bsp_qpi_cmd_multi_read(
	uint8_t cmd,
	uint32_t addr, qspi_cmd_adrlen_type addr_len,
	uint8_t *buff, uint8_t len);

void bsp_qpi_cmd_multi_write(
	uint8_t cmd,
	uint32_t addr, qspi_cmd_adrlen_type addr_len,
	const uint8_t *buff, uint8_t len);
/*****************************************************************************
* @brief   addr read.
*****************************************************************************/
void bsp_qpi_addr_read(
	uint8_t cmd,
	uint32_t addr, qspi_cmd_adrlen_type addr_len,
	uint8_t dummy,
	uint8_t *buf, uint16_t total_len);
/*****************************************************************************
* @brief   addr write.
*****************************************************************************/
void bsp_qpi_addr_write(
	uint8_t cmd,
	uint32_t addr, qspi_cmd_adrlen_type addr_len,
	const uint8_t *buf, uint16_t total_len);

#endif /* _BSP_QPI_OPT_H_ */
